package com.javakc.copyrightin.batch.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@Table(name = "bms_batch")
@EntityListeners(AuditingEntityListener.class)
public class Batch {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "书籍主键，采用数据库自增的方式")
    private Integer id ;
    /** 批次名称 */
    @Column(name = "name")
    @ApiModelProperty(value = "批次名称")
    private String name ;
    /** 授权开始时间 */
    @Column(name = "start_time")
    @ApiModelProperty(value = "授权开始时间")
    private Date startTime ;
    /** 授权结束时间 */
    @Column(name = "end_time")
    @ApiModelProperty(value = "授权结束时间")
    private Date endTime ;
    /** 分成比例 */
    @Column(name = "proportion")
    @ApiModelProperty(value = "分成比例")
    private String proportion ;
    /** 版权外键 */
    @Column(name = "copyright_id")
    @ApiModelProperty(value = "版权外键")
    private Integer copyrightId ;

    @Column(name = "bms_create",updatable = false)
    @ApiModelProperty(value = "创建时间", example = "2020-12-12 9:00:00")
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss", timezone = "GMT+8")
    private Date bmsCreate ;

    @Column(name = "bms_modified",insertable = false)
    @ApiModelProperty(value = "更新时间", example = "2020-12-12 9:00:00")
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss", timezone = "GMT+8")
    private Date bmsModified ;


//    @ManyToOne
//    @JoinColumn(name = "copyright_id")
//    private ClassRoom classRoom;


}
